using System;
using System.Threading;

namespace mom
{
    public class SyncContextHelper : IDisposable
    {
        private readonly SynchronizationContext _outer;
        public SyncContextHelper()
        {
            _outer = SynchronizationContext.Current;
            SynchronizationContext.SetSynchronizationContext(Loop.Ins);
        }

        public void Dispose()
        {
            SynchronizationContext.SetSynchronizationContext(_outer);
        }
    }
}